/**
 * Copyright (C) 2016 Juno Inc., All Rights Reserved.
 */
package com.jyl.designPattern.behavioral.observer;

/**
 *
 * @author Long, E-mail:jyl0401@163.com
 * @date 2019年4月22日 上午7:17:44
 */
public class Client {

	public static void main(String[] args) {
		NewsPaper subject = new NewsPaper();
		
		Reader reader1 = new Reader();
		reader1.setName("张三");
		
		Reader reader2 = new Reader();
		reader2.setName("李四");
		
		Reader reader3 = new Reader();
		reader3.setName("王五");
		
		subject.attach(reader1);
		subject.attach(reader2);
		subject.attach(reader3);
		
		subject.setContent("本期内容是观察者模式");
		System.out.println("------------------------------------");
		
		subject.detach(reader2);
		subject.setContent("本期内容是观察者模式");
		
	}
}
